'use strict'
/**
 * HttpUtil
 * 请求处理工具类
 * 你是一段成熟的代码，要学会自己改bug  ----我是小尾巴
 */

import http from './xhr/AxiosUtil'

/**
 * 请求参数信息
 * @type {{responseType: {BLOB: string, NULL: string, JSON: string, TEXT: string}, httpParams: {PREFIX: string, PACKAGE: string, BASE_URL: string}, requestMethod: {DELETE: string, POST: string, GET: string, PUT: string}}}
 */
const httpParam = {
  ...http.getParam()
}

export {
  httpParam
}

/**
 * ajax请求
 * @param method
 * @param url
 * @param params
 * @param success
 * @param resType
 * @param other
 */
export function request (method, url, params, success, resType, other) {
  http.request(method, url, params, success, resType, other)
}

/**
 * ajaxGet请求
 * @param url
 * @param params
 * @param success
 * @param resType
 * @param other
 */
export function requestGet (url, params, success, resType, other) {
  http.requestGet({url, params, success, resType, other})
}

/**
 * ajaxPost请求
 * @param url
 * @param params
 * @param success
 * @param resType
 * @param other
 */
export function requestPost (url, params, success, resType, other) {
  http.requestPost({url, params, success, resType, other})
}

/**
 * 获取请求对象
 * @param method
 * @param url
 * @param params
 * @param resType
 * @returns {*}
 */
export function requestObject (method, url, params, resType) {
  return http.requestObject(method, url, params, resType)
}

/**
 * 并发请求处理
 * @param functionArray
 * @param success
 * @param other
 */
export function requestAll (functionArray = [], success = null, other) {
  http.requestAll(functionArray, success, other)
}
